
import java.util.*;
import java.io.*;

public class ReadFileReverse {

	   
	public static void main (String args[]) throws IOException 
	{
		String DataFile = "C:\\Users\\Shallu\\Documents\\wbt\\ReadFileReverse.txt";//text file location
		FileReader fr=new FileReader(DataFile);
		BufferedReader readtext= new BufferedReader(fr);
		String[] textdata=new String[7];
		String[] revtext=new String[7];
		int j=6;
		int k=0;
		
		
		for (int i=0; i<textdata.length; i++)
		{
		textdata[i]=readtext.readLine();
		revtext[j]=textdata[i];
		j--;
		
		}
		readtext.close();
		
		String writefile="C:\\Users\\Shallu\\Documents\\wbt\\WriteFileReverse.txt";
		FileWriter fw=new FileWriter(writefile);
		BufferedWriter writetext=new BufferedWriter(fw);		
		
		for(k=0; k<revtext.length; k++)
		{
			writetext.newLine();
			writetext.write(revtext[k]);
		
		}
		
		writetext.close();
		
		
	}
			
	 
	
}
